#define _CRT_SECURE_NO_WARNINGS 1
#include<string>
#include<iostream>
using namespace std;

struct people
{
	string name;
	string birthday;
	string sex;
	string telephone;
	string phone;
}peo[10];

int main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> peo[i].name >> peo[i].birthday >> peo[i].sex >> peo[i].telephone >> peo[i].phone;
	}
	int k; cin >> k;
	while (k--) {
		int num; cin >> num;
		if (num >= 0 && num <= n - 1) {
			cout << peo[num].name << " " << peo[num].telephone << " " << peo[num].phone << " " << peo[num].sex << " " << peo[num].birthday << endl;
		}
		else {
			cout << "Not Found" << endl;
		}
	}
	return 0;
}